package com.xyf.sys.mapper;

import com.xyf.sys.domain.UserOrderEvent;
import com.xyf.sys.vo.UserEventStatistic;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface SysUserOrderEventMapper {
    int deleteByPrimaryKey(Long id);

    int insert(UserOrderEvent record);

    int insertSelective(UserOrderEvent record);

    UserOrderEvent selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(UserOrderEvent record);

    int updateByPrimaryKey(UserOrderEvent record);

    UserOrderEvent selectByUserIdAndOrderIdAndOrderProductIdAndType(@Param("userId") String userId,
                                                                    @Param("orderId") String orderId,
                                                                    @Param("orderProductId") String orderProductId,
                                                                    @Param("type") Integer type);
    UserOrderEvent selectByDeptIdAndOrderIdAndOrderProductIdAndType(@Param("deptId") Long deptId,
                                                                    @Param("orderId") String orderId,
                                                                    @Param("orderProductId") String orderProductId,
                                                                    @Param("type") Integer type);

    List<UserOrderEvent> selectList(@Param("userId") String userId, @Param("status") String status, @Param("eventType") Integer eventType);

    List<UserOrderEvent> selectListByDept(@Param("deptId") Long deptId, @Param("status") String status, @Param("eventType") Integer eventType);

    int countByUserIdAndType(@Param("userId") String userId, @Param("type") Integer type);

    UserOrderEvent selectByOrderIdAndOrderProductIdAndType(@Param("orderId") String orderId,
                                                           @Param("orderProductId") String orderProductId,
                                                           @Param("type") Integer type);

    List<UserEventStatistic> selectByUserIdAndStatus(@Param("userId") String userId, @Param("status") String status);

    List<UserEventStatistic> selectByDeptIdAndStatus(@Param("deptId") Long deptId, @Param("status") String status);

    UserOrderEvent selectByUserIdAndOrderIdAndOrderProductIdAndStatus(@Param("userId") String userId,
                                                                    @Param("orderId") String orderId,
                                                                    @Param("orderProductId") String orderProductId,
                                                                    @Param("status") String status);

    UserOrderEvent selectByUserIdAndOrderIdAndOrderProductIdAndStatusAndType(@Param("userId") String userId,
                                                                             @Param("orderId") String orderId,
                                                                             @Param("orderProductId") String orderProductId,
                                                                             @Param("type") Integer type,
                                                                             @Param("status") String status);
    UserOrderEvent selectByDeptIdAndOrderIdAndOrderProductIdAndStatusAndType(@Param("deptId") Long deptId,
                                                                             @Param("orderId") String orderId,
                                                                             @Param("orderProductId") String orderProductId,
                                                                             @Param("type") Integer type,
                                                                             @Param("status") String status);

    List<UserOrderEvent> selectAll();
}